{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {
    "collapsed": true,
    "pycharm": {
     "name": "#%%\n"
    }
   },
   "outputs": [],
   "source": [
    "from sqlalchemy import create_engine\n",
    "from sqlalchemy.orm import sessionmaker\n",
    "\n",
    "# sqlite 例子\n",
    "database_url ='sqlite:///test.db'\n",
    "# URL <database_urls>\n",
    "engine = create_engine(database_url)\n",
    "# 创建DBSession类型:\n",
    "Session = sessionmaker(bind=engine)\n",
    "# 创建session对象\n",
    "session = Session()\n",
    "\n",
    "session.execute('''CREATE TABLE COMPANY\n",
    "       (ID INT PRIMARY KEY     NOT NULL,\n",
    "       NAME           TEXT    NOT NULL,\n",
    "       AGE            INT     NOT NULL,\n",
    "       ADDRESS        CHAR(50),\n",
    "       SALARY         REAL);''')\n",
    "session.commit()\n",
    "session.close()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "outputs": [],
   "source": [
    "\n"
   ],
   "metadata": {
    "collapsed": false,
    "pycharm": {
     "name": "#%%\n"
    }
   }
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 2
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython2",
   "version": "2.7.6"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 0
}